/**
 * 导入结果混入
 */
import Vue from 'vue'
import {
  ACCESS_TOKEN,
  TENANT_ID
} from "@/store/mutation-types"
export default {
  data() {
    return {
      isResultModal: false, //弹窗状态
      current: 1, //页码
      resultTotal: 0, //总条数
      resultData: [], //all
      twoResultData: [], //check
      uploadData: {}, //params
    }
  },
  computed: {
    // 请求头
    tokenHeader() {
      let head = {
        'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)
      }
      let tenantid = Vue.ls.get(TENANT_ID)
      if (tenantid) {
        head['tenant_id'] = tenantid
      }
      return head;
    },
    // 导入文件目标地址
    uploadUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.uploadUrl}`;
    },
  },
  methods: {
    // 切换页码
    resultPageChange(index) {
      this.current = index
      this.$nextTick(() => {
        this.$refs.ImportResultRef.pageNoChange(this.resultData, this.current)
      })
    },
    // 改变选中数据
    pageNoChange(data) {
      this.twoResultData = data
    },
  }
}